package ru.st.selenium;

import static org.junit.Assert.assertEquals;


import org.testng.annotations.*;

import ru.st.selenium.model.Film;
import ru.st.selenium.pages.NewFilmPage;

public class AddMovie extends ru.st.selenium.pages.TestBase {
  
	 @BeforeMethod
	  public void goToMainPage() {
	    app.getNavigationHelper().openMainPage();
	  }
	
    @Test
    public void AddMovieTrue() throws Exception {
        Film film = new Film().setImdb("123").setTitle("TrueTitle").setYear("1999");
        app.getFilmHelper().create(film);        
    }
    
    @Test
    public void AddMovieFalse() throws Exception{
  	   StringBuffer verificationErrors = new StringBuffer();
        Film film = new Film().setImdb("123").setYear("1999");
        app.getFilmHelper().create(film);    
        try {
            assertEquals("This field is required", NewFilmPage.LabelError);
          } catch (Error e) {
            verificationErrors.append(e.toString());
          }
    }
}